package com.xm_jd.controller.dd;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xm_jd.model.dao.index5Dao;
import com.xm_jd.model.entitys.tb_user;
import com.xm_jd.model.entitys.user;
import com.xm_jd.utils.BaseServlet;

/**
 * Servlet implementation class index5
 */
@WebServlet("/index5")
public class index5 extends BaseServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public index5() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			int user_id = 1;
		List<user> sy = new index5Dao().getselectu(user_id);
		user yy = sy.get(0);
	
		String sex = request.getParameter("sex");
		String nc = request.getParameter("nc");
		String name = request.getParameter("name");
		if(sex!=null && nc!=null  && name!=null){
		new index5Dao().xg(sex, nc, name, user_id);
		}
		if(sy.size()>0){
		request.setAttribute("yy", yy);
		}
		//request.getRequestDispatcher("jsps/dd/dd_index5.jsp").forward(request, response);
		this.forward("dd/dd_index5");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
